var express = require('express');
var router = express.Router();

const User = require('./users'),
  Songlist = require('./songlist'),
  Classify = require('./classify'),
  Carousel = require('./carousel'),
  Music = require('./music');

let List = {
  ...User,
  ...Carousel,
  ...Songlist,
  ...Classify,
  ...Music,
}

for (let key in List) {
  let [method, url] = key.split(' ');
  if (method === 'POST') {
    router.post(url, List[key]);
  } else if (method === 'GET') {
    router.get(url, List[key]);
  }
}

module.exports = router;